package org.bingo.repository;

import org.bingo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface UserRepository extends JpaRepository<User, Long> {
    User findByUsername(String username);
    @Query(nativeQuery = true, value = "delete from user_video_like where video_id = ?")
    @Modifying
    void dropLikeRelation(Long videoId);
    @Query(nativeQuery = true, value = "delete from user_video_collect where video_id = ?")
    @Modifying
    void dropCollectRelation(Long videoId);
}
